#include <stdio.h>

#define P1 1
#define P2 2
#define P3 3
#define TOT 6
typedef int Position;
Position Ano(Position,Position);
void Hanoi(int start,int end,Position sp,Position ep);
void Move(int index,Position,Position);

int static count=0;
int main(void){
	Hanoi(1,7,P1,P3);
	printf("%d\n",count);
	return 0;
}


Position Ano(Position p1,Position p2){
	return TOT-p1-p2;
}
void Move(int index,Position p1,Position p2){
	//printf("%4d: Move %4d from P:%d to P:%d\n",count++,index,p1,p2);
	count++;
	return;
}
void Hanoi(int start,int end,Position sp,Position ep){
	if( start == end )
		Move(start,sp,ep);
	else{
		Hanoi(start,end-1,sp,Ano(sp,ep));
		//Hanoi(end,end,sp,ep);
		Move(end,sp,ep);
		Hanoi(start,end-1,Ano(sp,ep),ep);
	}
	return;
}
